package org.jeecg.modules.wmhb.service;

import org.jeecg.common.system.vo.SelectTreeModel;
import org.jeecg.modules.wmhb.entity.BOMNode;
import org.jeecg.modules.wmhb.entity.PurchaseBom;
import org.jeecg.modules.wmhb.entity.WmItem;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.wmhb.entity.WmTask;
import org.jeecg.modules.wmhb.vo.WmBuyVo;
import org.jeecg.modules.wmhb.vo.WmMaterialVo;

import java.util.List;
import java.util.Map;

/**
 * @Description: 物料产品表
 * @Author: jeecg-boot
 * @Date:   2024-08-31
 * @Version: V1.0
 */
public interface IWmItemService extends IService<WmItem> {
    /**
     * 检查物料编码是否唯一
     * @param wmItem
     * @return
     */
    public String checkItemCodeUnique(WmItem wmItem);

    /**
     * 检查物料名称是否唯一
     * @param wmItem
     * @return
     */
    public String checkItemNameUnique(WmItem wmItem);

    /**
     * 根据合同ID加载分类字典的数据
     *
     * @param wmContractId
     * @return
     */
    public List<SelectTreeModel> queryListByContract(String wmContractId);

    public WmItem selectByCode(String code);

    public WmItem selectByName(String name);

    /**
     *通过批次号设置产品状态
     */
    public void setConfirmByBatchNo(String batchNo);

    /**
     * 导入采购BOM
     * @param purchaseBom
     * @param batchNo
     */
    public Map<String, Object> importWmPurchaseTaskbookBom(PurchaseBom purchaseBom, String batchNo);

    /**
     * 导入主数据BOM
     * @param wmMaterialVoList
     * @param wmTask
     */
    public WmItem importMaterialBom(List<WmMaterialVo> wmMaterialVoList, WmTask wmTask);

    /**
     * 导入主数据BOM
     * @param wmBuyVoList
     * @param wmTask
     */
    public WmItem importBuyBom(List<WmBuyVo> wmBuyVoList, WmTask wmTask);

    /**
     * 添加任务时添加产品
     * @param wmTask
     */
    public Map<String, Object> saveItemWhenAddTask(WmTask wmTask);

    /**
     * 导入合同产品时添加产品
     * @param bomNode
     * @param batchNo
     * @param wmContractId
     */
    public Map<String, Object> saveItemWhenImportContractProduct(BOMNode bomNode, String batchNo, String wmContractId);

    /**
     * 获取所有项目列表
     * @return
     */
    public List<WmItem> projectList();
}
